<!DOCTYPE html>
<html class="writer-html5" lang="en" data-content_root="../">
<head>
  <meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />

  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>issue_creator &mdash; The Logtalk Handbook v3.93.0-b01 documentation</title>
      <link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=d75fae25" />
      <link rel="stylesheet" type="text/css" href="../_static/css/theme.css?v=19f00094" />
      <link rel="stylesheet" type="text/css" href="../_static/css/custom.css?v=396eccfe" />

  
  <!--[if lt IE 9]>
    <script src="../_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
        <script src="../_static/jquery.js?v=5d32c60e"></script>
        <script src="../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
        <script src="../_static/documentation_options.js?v=c8100655"></script>
        <script src="../_static/doctools.js?v=9a2dae69"></script>
        <script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
    <script src="../_static/js/theme.js"></script>
    <!-- begin favicon -->
    <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
    <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
    <link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
    <link rel="manifest" href="/site.webmanifest" />
    <link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5" />
    <meta name="msapplication-TileColor" content="#355b95" />
    <meta name="theme-color" content="#ffffff" />
    <!-- end favicon -->
    
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="lgtdoc" href="lgtdoc.html" />
    <link rel="prev" title="help" href="help.html" />
   
</head>

<body class="wy-body-for-nav"> 
  <div class="wy-grid-for-nav">
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search" >

          
          
          <a href="../index.html" class="icon icon-home">
            The Logtalk Handbook
              <img src="../_static/logtalk.gif" class="logo" alt="Logo"/>
          </a>
              <div class="version">
                3.93.0
              </div>
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>
        </div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
    
              <p class="caption" role="heading"><span class="caption-text">Contents</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../userman/index.html">User Manual</a></li>
<li class="toctree-l1"><a class="reference internal" href="../refman/index.html">Reference Manual</a></li>
<li class="toctree-l1"><a class="reference internal" href="../tutorial/index.html">Tutorial</a></li>
<li class="toctree-l1"><a class="reference internal" href="../faq/index.html">FAQ</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="index.html">Developer Tools</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="overview.html">Overview</a></li>
<li class="toctree-l2"><a class="reference internal" href="asdf.html"><code class="docutils literal notranslate"><span class="pre">asdf</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="assertions.html"><code class="docutils literal notranslate"><span class="pre">assertions</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="code_metrics.html"><code class="docutils literal notranslate"><span class="pre">code_metrics</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="dead_code_scanner.html"><code class="docutils literal notranslate"><span class="pre">dead_code_scanner</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="debug_messages.html"><code class="docutils literal notranslate"><span class="pre">debug_messages</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="debugger.html"><code class="docutils literal notranslate"><span class="pre">debugger</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="diagrams.html"><code class="docutils literal notranslate"><span class="pre">diagrams</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="doclet.html"><code class="docutils literal notranslate"><span class="pre">doclet</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="help.html"><code class="docutils literal notranslate"><span class="pre">help</span></code></a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#"><code class="docutils literal notranslate"><span class="pre">issue_creator</span></code></a><ul>
<li class="toctree-l3"><a class="reference internal" href="#requirements">Requirements</a></li>
<li class="toctree-l3"><a class="reference internal" href="#loading">Loading</a></li>
<li class="toctree-l3"><a class="reference internal" href="#usage">Usage</a></li>
<li class="toctree-l3"><a class="reference internal" href="#known-issues">Known issues</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="lgtdoc.html"><code class="docutils literal notranslate"><span class="pre">lgtdoc</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="lgtunit.html"><code class="docutils literal notranslate"><span class="pre">lgtunit</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="linter.html"><code class="docutils literal notranslate"><span class="pre">linter</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="make.html"><code class="docutils literal notranslate"><span class="pre">make</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="packs.html"><code class="docutils literal notranslate"><span class="pre">packs</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="ports_profiler.html"><code class="docutils literal notranslate"><span class="pre">ports_profiler</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="profiler.html"><code class="docutils literal notranslate"><span class="pre">profiler</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="tutor.html"><code class="docutils literal notranslate"><span class="pre">tutor</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="wrapper.html"><code class="docutils literal notranslate"><span class="pre">wrapper</span></code></a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../libraries/index.html">Libraries</a></li>
<li class="toctree-l1"><a class="reference internal" href="../ports/index.html">Ports</a></li>
<li class="toctree-l1"><a class="reference internal" href="../contributions/index.html">Contributions</a></li>
<li class="toctree-l1"><a class="reference internal" href="../glossary.html">Glossary</a></li>
<li class="toctree-l1"><a class="reference internal" href="../bibliography.html">Bibliography</a></li>
<li class="toctree-l1"><a class="reference internal" href="../genindex.html">Index</a></li>
</ul>

    <p class="caption"><span class="caption-text">External Contents</span></p>
    <ul>
    <li class="toctree-l1"><a class="reference internal" href="../../apis/index.html">APIs</a></li>
    <li class="toctree-l1"><a class="reference internal" href="https://logtalk.org">Logtalk website</a></li>
    <li class="toctree-l1"><a class="reference internal" href="https://github.com/LogtalkDotOrg/logtalk3">GitHub repo</a></li>
    </ul>
  
        </div>
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../index.html">The Logtalk Handbook</a>
      </nav>

      <div class="wy-nav-content">
        <div class="rst-content">
          <div role="navigation" aria-label="Page navigation">
  <ul class="wy-breadcrumbs">
      <li><a href="../index.html" class="icon icon-home" aria-label="Home"></a></li>
          <li class="breadcrumb-item"><a href="index.html">Developer Tools</a></li>
      <li class="breadcrumb-item active"><code class="docutils literal notranslate"><span class="pre">issue_creator</span></code></li>
      <li class="wy-breadcrumbs-aside">
              <a href="https://github.com/LogtalkDotOrg/logtalk3/blob/master/docs/handbook/sources/devtools/issue_creator.rst" class="fa fa-github"> Edit on GitHub</a>
      </li>
  </ul>
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
             
  <section id="issue-creator">
<span id="library-issue-creator"></span><h1><code class="docutils literal notranslate"><span class="pre">issue_creator</span></code><a class="headerlink" href="#issue-creator" title="Link to this heading"></a></h1>
<p>This is a complementary tool for the <code class="docutils literal notranslate"><span class="pre">lgtunit</span></code> tool for automatically
creating bug report issues for failed tests in GitHub or GitLab servers.</p>
<section id="requirements">
<h2>Requirements<a class="headerlink" href="#requirements" title="Link to this heading"></a></h2>
<p>This tool requires that the GitHub <code class="docutils literal notranslate"><span class="pre">gh</span></code> and GitLab <code class="docutils literal notranslate"><span class="pre">glab</span></code> CLIs be
installed. For the installation instructions see:</p>
<ul class="simple">
<li><p>GitHub: <a class="reference external" href="https://cli.github.com">https://cli.github.com</a></p></li>
<li><p>GitLab: <a class="reference external" href="https://glab.readthedocs.io">https://glab.readthedocs.io</a></p></li>
</ul>
</section>
<section id="loading">
<h2>Loading<a class="headerlink" href="#loading" title="Link to this heading"></a></h2>
<p>This tool can be loaded using the query:</p>
<div class="highlight-logtalk notranslate"><div class="highlight"><pre><span></span>| <span class="o">?-</span> <span class="k">logtalk_load</span>(issue_creator(loader)).
</pre></div>
</div>
<p>But, in the most common usage scenario, this tool is automatically
loaded by the <code class="docutils literal notranslate"><span class="pre">logtalk_tester</span></code> automation script.</p>
</section>
<section id="usage">
<h2>Usage<a class="headerlink" href="#usage" title="Link to this heading"></a></h2>
<p>The <code class="docutils literal notranslate"><span class="pre">logtalk_tester</span></code> automation script accepts a <code class="docutils literal notranslate"><span class="pre">-b</span></code> option for
automatically using this tool (see the script man page for details). In
the most simple case, this option possible values are <code class="docutils literal notranslate"><span class="pre">github</span></code> and
<code class="docutils literal notranslate"><span class="pre">gitlab</span></code>. For example:</p>
<div class="highlight-logtalk notranslate"><div class="highlight"><pre><span></span><span class="err">$</span> logtalk_tester <span class="o">\</span>
    <span class="o">-</span>p gnu <span class="o">\</span>
    <span class="o">-</span>b github <span class="o">\</span>
    <span class="o">-</span>s <span class="s">&quot;/home/jdoe/foo/&quot;</span> <span class="o">\</span>
    <span class="o">-</span>u https<span class="o">://</span>github.com<span class="o">/</span>jdoe<span class="o">/</span>foo<span class="o">/</span>tree<span class="o">/</span><span class="m">55</span>aa900775befa135e0d5b48ea63098df8b97f5c<span class="o">/</span>
</pre></div>
</div>
<p>The <code class="docutils literal notranslate"><span class="pre">logtalk_tester</span></code> script <strong>must</strong> be called from a git repo
directory or one of its sub-directories, which is a common setup in
CI/CD pipelines. Moreover, prior to running the tests, the CLI must be
used, if required, to authenticate and login to the server where the bug
report issues will be created:</p>
<ul class="simple">
<li><p>GitHub: <code class="docutils literal notranslate"><span class="pre">gh</span> <span class="pre">auth</span> <span class="pre">login</span> <span class="pre">--hostname</span> <span class="pre">&lt;string&gt;</span> <span class="pre">--with-token</span> <span class="pre">&lt;</span> <span class="pre">token.txt</span></code></p></li>
<li><p>GitLab: <code class="docutils literal notranslate"><span class="pre">glab</span> <span class="pre">auth</span> <span class="pre">login</span> <span class="pre">--hostname</span> <span class="pre">&lt;string&gt;</span> <span class="pre">--token</span> <span class="pre">&lt;string&gt;</span></code></p></li>
</ul>
<p>The access token must have the necessary scopes that allow bug reports
to be created. See the CLIs documentation for details. Typically, the
<code class="docutils literal notranslate"><span class="pre">auth</span></code> command is called from the CI/CD pipeline definition scripts.
However, depending on the CI/CD workflow, the authentication may be done
implicitly.</p>
<p>The bug reports are created using by default the label <code class="docutils literal notranslate"><span class="pre">bug</span></code> and
assigned to the author of the latest commit of the git repo. The <code class="docutils literal notranslate"><span class="pre">-b</span></code>
option can also be used to override the label with a comma separated set
of labels. For example, to use both <code class="docutils literal notranslate"><span class="pre">bug</span></code> and <code class="docutils literal notranslate"><span class="pre">auto</span></code> labels:</p>
<div class="highlight-logtalk notranslate"><div class="highlight"><pre><span></span><span class="err">$</span> logtalk_tester <span class="o">\</span>
    <span class="o">-</span>p gnu <span class="o">\</span>
    <span class="o">-</span>b github<span class="o">:</span>bug,auto <span class="o">\</span>
    <span class="o">-</span>s <span class="s">&quot;/home/jdoe/foo/&quot;</span> <span class="o">\</span>
    <span class="o">-</span>u https<span class="o">://</span>github.com<span class="o">/</span>jdoe<span class="o">/</span>foo<span class="o">/</span>tree<span class="o">/</span><span class="m">55</span>aa900775befa135e0d5b48ea63098df8b97f5c<span class="o">/</span>
</pre></div>
</div>
<p>Note that the labels <strong>must</strong> be predefined in the issue tracker server
for the bug report to be successfully created. The <code class="docutils literal notranslate"><span class="pre">auto</span></code> label can be
used to simplify filtering of auto-generated bug reports when browsing
the issue tracker.</p>
<p>The bug reports use Markdown formatting, which is the default in GitHub
and GitLab issue trackers.</p>
<p>But reports are only created for non-flaky tests. The bug report title
and labels are used to prevent creating duplicated bug reports.
Therefore, the title should not be manually edited and the same labels
should be used for multiple runs of the same tests and preserved when
editing the bug reports.</p>
<p>There are cases where we may want to postpone or temporarily disable the
automatic creation of bug reports. E.g. a WIP branch that’s known to
break multiple tests. A solution is to define a pull/merge request
label, e.g. <code class="docutils literal notranslate"><span class="pre">NO_AUTO_BUG_REPORTS</span></code>, that can then be checked by the
CI/CD workflow. For example, we can test the presence of that label to
set a <code class="docutils literal notranslate"><span class="pre">AUTO_BUG_REPORTS</span></code> environment variable to either an empty
string or a <code class="docutils literal notranslate"><span class="pre">-b</span></code> option and use:</p>
<div class="highlight-logtalk notranslate"><div class="highlight"><pre><span></span>logtalk_tester.sh <span class="err">$</span><span class="nv">AUTO_BUG_REPORTS</span> <span class="o">-</span>p ...
</pre></div>
</div>
</section>
<section id="known-issues">
<h2>Known issues<a class="headerlink" href="#known-issues" title="Link to this heading"></a></h2>
<p>GitLab creates CI/CD pipelines in a detached HEAD state by default. As a
consequence, the git branch would be reported as HEAD. To workaround
this issue, this tool uses the value of the GitLab CI/CD pipeline
variable <code class="docutils literal notranslate"><span class="pre">CI_COMMIT_REF_NAME</span></code> when defined as the branch name.</p>
<p>This tool is in a beta stage of development. Your feedback is most
appreciated.</p>
</section>
</section>


           </div>
          </div>
          <footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
        <a href="help.html" class="btn btn-neutral float-left" title="help" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
        <a href="lgtdoc.html" class="btn btn-neutral float-right" title="lgtdoc" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
    </div>

  <hr/>

  <div role="contentinfo">
    <p>&#169; Copyright 1998-2025, Paulo Moura.</p>
  </div>

  Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
    <a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
    provided by <a href="https://readthedocs.org">Read the Docs</a>.
   

</footer>
        </div>
      </div>
    </section>
  </div>
  <script>
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script> 

</body>
</html>